{% set pypi_name = 'oslo.cache' %}
{% set upstream_version = upstream_version('2.6.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Cache storage for Openstack projects
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('dogpile.cache') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pymongo') }}
BuildRequires:  {{ py3('python-memcached') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('stestr') }}
BuildArch:      noarch

%description
oslo.cache aims to provide a generic caching mechanism for OpenStack projects
by wrapping the dogpile.cache library. The dogpile.cache library provides
support memoization, key value storage and interfaces to common caching
backends such as Memcached.

%package -n {{ py2name(py_versions='py3') }}
Summary:        Cache storage for Openstack projects
Requires:       {{ py3('dogpile.cache') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('python-memcached') }}
Requires:       {{ py3('six') }}

%description -n {{ py2name(py_versions='py3') }}
oslo.cache aims to provide a generic caching mechanism for OpenStack projects
by wrapping the dogpile.cache library. The dogpile.cache library provides
support memoization, key value storage and interfaces to common caching
backends such as Memcached.

%package -n {{ py2name() }}-doc
Summary:        Documentation for the OpenStack Oslo Cache library
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n {{ py2name() }}-doc
Documentation for the OpenStack Oslo cache library.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

# generate html docs
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc README.rst ChangeLog
%{python3_sitelib}/oslo_cache
%{python3_sitelib}/*.egg-info

%files -n {{ py2name() }}-doc
%license LICENSE
%doc doc/build/html

%changelog
